<?php

/* Message.php
 *
 * (C) 2012, StaySimple CMS team.
 *
 * This file is part of StaySimple.
 * http://code.google.com/p/stay-simple-cms/
 *
 * StaySimple is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * StaySimple is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with StaySimple.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Represents a message that is sent from controllers to the user.
 */
class Message {

    /**
     * @var string The message text.
     */
    private $message;
    
    /**
     * @var int Message type, can be of type Message::$SUCCESS or Message::$ERROR.
     */
    private $type;

    /**
     * @var int Represents a message of type success.
     */
    public static $SUCESS = 1;

    /**
     * @var int Represents a message of type error.
     */
    public static $ERROR = 2;

    public function __construct($message, $type = 1) {
        $this->message = $message;
        $this->type = $type;
    }

    /**
     * The message text. Returns the message text as a string, any i18n action 
     * must be done outside the message object.
     * 
     * @return string The message to show the user.
     */
    public function getMessage() {
        return $this->message;
    }

    /**
     * Returns the type that this message represents. Currently only error and 
     * success messages exist but other message types may be introduced in 
     * future versions.
     * 
     * @return int The message's type
     */
    public function getType() {
        return $this->type;
    }

}
